<template>
	<div class="Word">
		<a href="#" @click.prevent="open_pageoffice('Word')">POBrowser方式打开Word文档</a><br><br><br>
		<div>Count=<input id="Text1" type="text" value="0" /></div>
		<router-view></router-view>
	</div>
</template>

<script>
import request from '@/utils/request'
import { POBrowser } from 'js-pageoffice'
export default {
	name: 'index',
	data() {
		return {
			titleText: '',
			count:0
		}
	},
	created: function () {
		this.index().then(response => {
			this.titleText = response;
		});
	},
	methods: {
		//控件中的一些常用方法都在这里调用，比如保存，打印等等	      
		updateCount(value) {
			this.count = this.count + parseInt(value);
			document.getElementById("Text1").value = this.count;
			return this.count.toString();
		},
		open_pageoffice(vue_page_url) {
			POBrowser.openWindow(vue_page_url, 'width=1200px;height=800px;');
		},
		index() {
			//发起GET请求到后端Controller的/index路由
			return request({
				url: '/index',
				method: 'get',
			})
		}
	},
	mounted: function () {
		//updataCount方法必须挂载到window对象上，否则控件调用不到
		window.updateCount= this.updateCount;//此行必须
	}
}
</script>
<style scoped>  
a{  
  display: block;
   margin-top: 30px;
  text-decoration: underline;  
}  
</style>
